<%@ include file="connect.jsp" %>

<%
    String pert = request.getParameter("question");
    String pilA = request.getParameter("pilA");
    String pilB = request.getParameter("pilB");
    String pilC = request.getParameter("pilC");
    String pilD = request.getParameter("pilD");
    String Ans = request.getParameter("answer");
    String detailtestID = request.getParameter("detailtestID");
    String idTest = request.getParameter("idTest");
    String ganti = pert.replaceAll("'", "''");
    String target = request.getParameter("option");


    stat.executeUpdate("INSERT INTO DetailQuestion (Answer, detailTestID, Option_1, Option_2, Option_3, Option_4, Question, Target, stylesID) " +
            "values ('" + Ans + "', '" + detailtestID + "', '" + pilA + "','" + pilB + "','" + pilC + "','" + pilD + "','" + ganti + "','"+target+"',1) ");

    if (idTest.equals("1")) {

        response.sendRedirect("pretest.jsp?respon=Successfully added question!");


    } else if (idTest.equals("2")) {

        response.sendRedirect("posttest.jsp?respon=Successfully added question!");


    }

    conn.close();

%>
